#ifndef Base_Handle_h
#define Base_Handle_h

#include "BaseModule.h"
#include "Config.h"

SG_NAMESPACE_OPEN

namespace Base
{
    /**
     * @brief Resource Wrapper to reference the heavy resource.
     *
     * @see https://www.boost.org/doc/libs/1_85_0/libs/scope/doc/html/scope/unique_resource.html
     * @author nene
     * @date November, 2024.
     */
    template <typename TResourceType>
    class BASE_EXPORT Handle
    {
    public:
        typedef /*typename*/ TResourceType ResourceType;

    public:
        Handle (ResourceType *entity)
        {
            mEntity = entity;
        }

        /// Support the use of -> to call methods of the underlying resource.
        ResourceType *operator->() const
        {
            return mEntity;
        }

        /// Access the underlying resource.
        ResourceType &operator* ()
        {
            return *mEntity;
        }

        /// Access the underlying resource.
        const ResourceType &operator* () const
        {
            return *mEntity;
        }

    private:
        ResourceType *mEntity = nullptr;
    };
}

SG_NAMESPACE_CLOSE

#endif  // Base_Handle_h